using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using OpenTK.Math;

namespace Dogfight2008.Tests
{
  class MockRenderer : IRenderer
  {
    public delegate void TextAtDelegate(int callnumber, string text, Uniform x, Uniform y, Uniform height, Anchor anchor);
    public delegate void MeshAtDelegate(int callnumber, Mesh mesh, Matrix4 transform);

    TextAtDelegate textAt;
    MeshAtDelegate meshAt;

    int textAtCalls = 0;
    int meshAtCalls = 0;

    public bool TextAtCalled
    {
      get
      {
        return textAtCalls > 0;
      }
    }

    public bool MeshAtCalled
    {
      get
      {
        return meshAtCalls > 0;
      }
    }

    public MockRenderer(
      TextAtDelegate textAtVerification,
      MeshAtDelegate meshAtVerification)
    {
      textAt = textAtVerification;
      meshAt = meshAtVerification;
    }

    #region IRenderer Members

    public void TextAt(string text, Uniform x, Uniform y, Uniform height,  Anchor anchor)
    {
      if (textAt != null)
      {
        textAt(textAtCalls, text, x, y, height, anchor);
        textAtCalls++;
      }
    }

    public void MeshAt(Mesh mesh, Matrix4 transform)
    {
      if (meshAt != null)
      {
        meshAt(meshAtCalls, mesh, transform);
        meshAtCalls++;
      }
    }

    public void Rotate(Vector3 axis, double rad)
    {
    }

    public void Translate(Vector3 translation)
    {
    }

    public void Color(Color color)
    {
    }

    public void DrawMesh(Mesh mesh)
    {
    }

    public void DrawMeshIgnoreColors(Mesh mesh)
    {
    }

    public void DrawLine(Vector3 from, Vector3 to)
    {
    }

    public void PushMatrix()
    {
    }

    public void PopMatrix()
    {
    }

    #endregion
  }
}
